fix: use &[T] instead of &Vec<T> in function signatures#190
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the flexibility of internal transaction verification helpers by switching their parameters from &Vec<T> to slice references (&[T]), allowing callers to pass any contiguous collection (including Vec, arrays, and slices) without forcing a concrete Vec type.
Changes:
- Updated
verify_interests_transactionsto accept&[(String, T, T)]instead of&Vec<(String, T, T)>. - Updated
verify_dividends_transactionsto accept&[(String, T, T, Option<String>)]instead of&Vec<...>. - Updated
verify_transactionsto accept&[(String, String, T, T, Option<String>)]instead of&Vec<...>.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| /// Check if all interests rate transactions come from the same year | ||
| pub fn verify_interests_transactions<T>(transactions: &Vec<(String, T, T)>) -> Result<(), String> { | ||
| pub fn verify_interests_transactions<T>(transactions: &[(String, T, T)]) -> Result<(), String> { |
There was a problem hiding this comment.
The PR title suggests a general move away from &Vec<T> in function signatures, but src/transactions.rs still contains public functions taking &Vec<...> (e.g., reconstruct_sold_transactions) and src/lib.rs has &Vec<...> params as well. Consider updating the remaining signatures to slices (&[...]) in this PR or adjusting the PR scope/title so the change is consistent and expectations are clear.
No description provided.